package controller;

import exception.MyException;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.sql.SQLException;

public abstract class BaseController {
    @ExceptionHandler
    public String exception(Exception ex){
        if(ex instanceof SQLException){
            return "sql-error";
        } else if (ex instanceof MyException) {
            return "my-error";
        }else{
            return "error";
        }
    }
}
